-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support reload in ReactDelegate #43521
Closed
arushikesarwani94
wants to merge
1
commit into
facebook:main
from
arushikesarwani94:export-D54967602
Closed
Support reload in ReactDelegate #43521
arushikesarwani94
wants to merge
1
commit into
facebook:main
from
arushikesarwani94:export-D54967602
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
facebook-github-bot
added
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
p: Facebook
Partner: Facebook
Partner
labels
Mar 16, 2024
This pull request was exported from Phabricator. Differential Revision: D54967602 |
Base commit: ff5e1a6 |
Summary: Changelog: [Android] [Added] - Support reload() in ReactDelegate Differential Revision: D54967602
arushikesarwani94
force-pushed
the
export-D54967602
branch
from
March 19, 2024 06:02
1ce27bc
to
d5d55bf
Compare
This pull request was exported from Phabricator. Differential Revision: D54967602 |
This pull request has been merged in d97741a. |
arushikesarwani94
added a commit
to arushikesarwani94/react-native
that referenced
this pull request
Mar 21, 2024
Summary: Supported `reload()` in Bridgeless through ReactDelegate in facebook#43521 in order to unblock react-native-restart https://github.com/avishayil/react-native-restart/blob/134cabd5b3f355ffe551e5dd1be1dd46d870fe13/android/src/main/java/com/reactnativerestart/RestartModule.java#L54 which can access React Delegate through : ``` if(currentActivity instanceof ReactActivity) { ReactActivity reactActivity = (ReactActivity) currentActivity; ReactDelegate reactDelegate = reactActivity.getReactDelegate(); reactDelegate.reload() } ``` Changelog: [Android][Added] Expose ReactDelegate in ReactActivity Differential Revision: D55166962
arushikesarwani94
added a commit
to arushikesarwani94/react-native
that referenced
this pull request
Mar 21, 2024
Summary: Supported `reload()` in Bridgeless through ReactDelegate in facebook#43521 in order to unblock react-native-restart https://github.com/avishayil/react-native-restart/blob/134cabd5b3f355ffe551e5dd1be1dd46d870fe13/android/src/main/java/com/reactnativerestart/RestartModule.java#L54 which can access React Delegate through : ``` if(currentActivity instanceof ReactActivity) { ReactActivity reactActivity = (ReactActivity) currentActivity; ReactDelegate reactDelegate = reactActivity.getReactDelegate(); reactDelegate.reload() } ``` Changelog: [Android][Added] Expose ReactDelegate in ReactActivity Differential Revision: D55166962
facebook-github-bot
pushed a commit
that referenced
this pull request
Mar 21, 2024
Summary: Pull Request resolved: #43588 Supported `reload()` in Bridgeless through ReactDelegate in #43521 in order to unblock react-native-restart https://github.com/avishayil/react-native-restart/blob/134cabd5b3f355ffe551e5dd1be1dd46d870fe13/android/src/main/java/com/reactnativerestart/RestartModule.java#L54 which can access React Delegate through : ``` if(currentActivity instanceof ReactActivity) { ReactActivity reactActivity = (ReactActivity) currentActivity; ReactDelegate reactDelegate = reactActivity.getReactDelegate(); reactDelegate.reload() } ``` Changelog: [Android][Added] Expose ReactDelegate in ReactActivity Reviewed By: cortinico Differential Revision: D55166962 fbshipit-source-id: 5d8dfd7ad61edbcb5233014800eb66a538842ca5
cortinico
pushed a commit
that referenced
this pull request
Mar 25, 2024
Summary: Pull Request resolved: #43521 Changelog: [Android] [Added] - Support reload() in ReactDelegate Reviewed By: cortinico Differential Revision: D54967602 fbshipit-source-id: adfa200cabcbecf9507775ac38f17c9d01b2671a
cortinico
pushed a commit
that referenced
this pull request
Mar 25, 2024
Summary: Pull Request resolved: #43588 Supported `reload()` in Bridgeless through ReactDelegate in #43521 in order to unblock react-native-restart https://github.com/avishayil/react-native-restart/blob/134cabd5b3f355ffe551e5dd1be1dd46d870fe13/android/src/main/java/com/reactnativerestart/RestartModule.java#L54 which can access React Delegate through : ``` if(currentActivity instanceof ReactActivity) { ReactActivity reactActivity = (ReactActivity) currentActivity; ReactDelegate reactDelegate = reactActivity.getReactDelegate(); reactDelegate.reload() } ``` Changelog: [Android][Added] Expose ReactDelegate in ReactActivity Reviewed By: cortinico Differential Revision: D55166962 fbshipit-source-id: 5d8dfd7ad61edbcb5233014800eb66a538842ca5
arushikesarwani94
added a commit
to arushikesarwani94/react-native
that referenced
this pull request
Mar 25, 2024
Summary: facebook#43521 & facebook#43588 aimed to fix `react-native-restart`, however in release `handleReloadJS()` is a no-op in [DisabledDevSupportManager](https://github.com/facebook/react-native/blob/ac714b1c3300d3a169bdcfec05d556e18a7b83ff/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java#L139) which is why this should not work. Fixing it by relying on `ReactHostImpl.reload()` instead for Bridgeless. Differential Revision: D55342296
arushikesarwani94
added a commit
to arushikesarwani94/react-native
that referenced
this pull request
Mar 25, 2024
Summary: facebook#43521 & facebook#43588 aimed to fix `react-native-restart`, however in release `handleReloadJS()` is a no-op in [DisabledDevSupportManager](https://github.com/facebook/react-native/blob/ac714b1c3300d3a169bdcfec05d556e18a7b83ff/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java#L139) which is why this should not work. Fixing it by relying on `ReactHostImpl.reload()` instead for Bridgeless. Differential Revision: D55342296
arushikesarwani94
added a commit
to arushikesarwani94/react-native
that referenced
this pull request
Mar 26, 2024
Summary: facebook#43521 & facebook#43588 aimed to fix `react-native-restart`, however in release `handleReloadJS()` is a no-op in [DisabledDevSupportManager](https://github.com/facebook/react-native/blob/ac714b1c3300d3a169bdcfec05d556e18a7b83ff/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java#L139) which is why this should not work. Fixing it by relying on `ReactHostImpl.reload()` instead for Bridgeless. Differential Revision: D55342296
arushikesarwani94
added a commit
to arushikesarwani94/react-native
that referenced
this pull request
Mar 26, 2024
Summary: facebook#43521 & facebook#43588 aimed to fix `react-native-restart`, however in release `handleReloadJS()` is a no-op in [DisabledDevSupportManager](https://github.com/facebook/react-native/blob/ac714b1c3300d3a169bdcfec05d556e18a7b83ff/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java#L139) which is why this should not work. Fixing it by relying on `ReactHostImpl.reload()` instead for Bridgeless. Differential Revision: D55342296
arushikesarwani94
added a commit
to arushikesarwani94/react-native
that referenced
this pull request
Mar 26, 2024
Summary: facebook#43521 & facebook#43588 aimed to fix `react-native-restart`, however in release `handleReloadJS()` is a no-op in [DisabledDevSupportManager](https://github.com/facebook/react-native/blob/ac714b1c3300d3a169bdcfec05d556e18a7b83ff/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java#L139) which is why this should not work. Fixing it by relying on `ReactHostImpl.reload()` instead for Bridgeless. Adding implementation of `DisabledDevSupportManager.handleReloadJS()` won't work as it would mean introducing circular dependency `devsupport` -> `runtime` Reviewed By: cortinico Differential Revision: D55342296
arushikesarwani94
added a commit
to arushikesarwani94/react-native
that referenced
this pull request
Mar 26, 2024
Summary: facebook#43521 & facebook#43588 aimed to fix `react-native-restart`, however in release `handleReloadJS()` is a no-op in [DisabledDevSupportManager](https://github.com/facebook/react-native/blob/ac714b1c3300d3a169bdcfec05d556e18a7b83ff/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java#L139) which is why this should not work. Fixing it by relying on `ReactHostImpl.reload()` instead for Bridgeless. Adding implementation of `DisabledDevSupportManager.handleReloadJS()` won't work as it would mean introducing circular dependency `devsupport` -> `runtime` Reviewed By: cortinico Differential Revision: D55342296
arushikesarwani94
added a commit
to arushikesarwani94/react-native
that referenced
this pull request
Mar 26, 2024
Summary: Pull Request resolved: facebook#43645 facebook#43521 & facebook#43588 aimed to fix `react-native-restart`, however in release `handleReloadJS()` is a no-op in [DisabledDevSupportManager](https://github.com/facebook/react-native/blob/ac714b1c3300d3a169bdcfec05d556e18a7b83ff/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java#L139) which is why this should not work. Fixing it by relying on `ReactHostImpl.reload()` instead for Bridgeless. Differential Revision: https://internalfb.com/D55342296
arushikesarwani94
added a commit
to arushikesarwani94/react-native
that referenced
this pull request
Mar 27, 2024
Summary: Pull Request resolved: facebook#43645 facebook#43521 & facebook#43588 aimed to fix `react-native-restart`, however in release `handleReloadJS()` is a no-op in [DisabledDevSupportManager](https://github.com/facebook/react-native/blob/ac714b1c3300d3a169bdcfec05d556e18a7b83ff/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java#L139) which is why this should not work. Fixing it by relying on `ReactHostImpl.reload()` instead for Bridgeless. Differential Revision: https://internalfb.com/D55342296
facebook-github-bot
pushed a commit
that referenced
this pull request
Mar 27, 2024
Summary: Pull Request resolved: #43645 #43521 & #43588 aimed to fix `react-native-restart`, however in release `handleReloadJS()` is a no-op in [DisabledDevSupportManager](https://github.com/facebook/react-native/blob/ac714b1c3300d3a169bdcfec05d556e18a7b83ff/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java#L139) which is why this should not work. Fixing it by relying on `ReactHostImpl.reload()` instead for Bridgeless. Adding implementation of `DisabledDevSupportManager.handleReloadJS()` won't work as it would mean introducing circular dependency `devsupport` -> `runtime` Reviewed By: cortinico Differential Revision: D55342296 fbshipit-source-id: ee6fba68586a2bdd1163522f75e6beb1b7736f6c
huntie
pushed a commit
that referenced
this pull request
Apr 2, 2024
Summary: Pull Request resolved: #43645 #43521 & #43588 aimed to fix `react-native-restart`, however in release `handleReloadJS()` is a no-op in [DisabledDevSupportManager](https://github.com/facebook/react-native/blob/ac714b1c3300d3a169bdcfec05d556e18a7b83ff/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java#L139) which is why this should not work. Fixing it by relying on `ReactHostImpl.reload()` instead for Bridgeless. Adding implementation of `DisabledDevSupportManager.handleReloadJS()` won't work as it would mean introducing circular dependency `devsupport` -> `runtime` Reviewed By: cortinico Differential Revision: D55342296 fbshipit-source-id: ee6fba68586a2bdd1163522f75e6beb1b7736f6c
This was referenced Apr 5, 2024
4 tasks
facebook-github-bot
pushed a commit
that referenced
this pull request
May 1, 2024
Summary: fixing some problem for `ReactActivity.getReactDelegate().reload()` from #43521: - the `reload()` does not work for bridge mode on release build ## Changelog: [ANDROID] [FIXED] - Fixed app reloading for `ReactActivity.getReactDelegate().reload()`. Pull Request resolved: #44223 Test Plan: tried to temporary change toast.show as reload and test from rn-tester ```diff --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.kt @@ -10,6 +10,7 @@ package com.facebook.react.modules.toast import android.view.Gravity import android.widget.Toast import com.facebook.fbreact.specs.NativeToastAndroidSpec +import com.facebook.react.ReactActivity import com.facebook.react.bridge.NativeModule import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.UiThreadUtil @@ -30,9 +31,11 @@ public class ToastModule(reactContext: ReactApplicationContext) : ) override public fun show(message: String?, durationDouble: Double) { - val duration = durationDouble.toInt() - UiThreadUtil.runOnUiThread( - Runnable { Toast.makeText(getReactApplicationContext(), message, duration).show() }) +// val duration = durationDouble.toInt() +// UiThreadUtil.runOnUiThread( +// Runnable { Toast.makeText(getReactApplicationContext(), message, duration).show() }) + val activity = reactApplicationContext.currentActivity as? ReactActivity + activity?.reactDelegate?.reload() } override public fun showWithGravity( ``` tried for different mode - [x] bridge mode + debug build - [x] bridgeless mode + debug build - [x] bridge mode + release build - [x] bridgeless mode + release build Reviewed By: fkgozali Differential Revision: D56795975 Pulled By: arushikesarwani94 fbshipit-source-id: 895eab1927ba6db748ebb32c0fd5313f19cf9d1b
cipolleschi
pushed a commit
that referenced
this pull request
May 2, 2024
Summary: fixing some problem for `ReactActivity.getReactDelegate().reload()` from #43521: - the `reload()` does not work for bridge mode on release build [ANDROID] [FIXED] - Fixed app reloading for `ReactActivity.getReactDelegate().reload()`. Pull Request resolved: #44223 Test Plan: tried to temporary change toast.show as reload and test from rn-tester ```diff --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.kt @@ -10,6 +10,7 @@ package com.facebook.react.modules.toast import android.view.Gravity import android.widget.Toast import com.facebook.fbreact.specs.NativeToastAndroidSpec +import com.facebook.react.ReactActivity import com.facebook.react.bridge.NativeModule import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.UiThreadUtil @@ -30,9 +31,11 @@ public class ToastModule(reactContext: ReactApplicationContext) : ) override public fun show(message: String?, durationDouble: Double) { - val duration = durationDouble.toInt() - UiThreadUtil.runOnUiThread( - Runnable { Toast.makeText(getReactApplicationContext(), message, duration).show() }) +// val duration = durationDouble.toInt() +// UiThreadUtil.runOnUiThread( +// Runnable { Toast.makeText(getReactApplicationContext(), message, duration).show() }) + val activity = reactApplicationContext.currentActivity as? ReactActivity + activity?.reactDelegate?.reload() } override public fun showWithGravity( ``` tried for different mode - [x] bridge mode + debug build - [x] bridgeless mode + debug build - [x] bridge mode + release build - [x] bridgeless mode + release build Reviewed By: fkgozali Differential Revision: D56795975 Pulled By: arushikesarwani94 fbshipit-source-id: 895eab1927ba6db748ebb32c0fd5313f19cf9d1b
kosmydel
pushed a commit
to kosmydel/react-native
that referenced
this pull request
May 6, 2024
Summary: fixing some problem for `ReactActivity.getReactDelegate().reload()` from facebook#43521: - the `reload()` does not work for bridge mode on release build ## Changelog: [ANDROID] [FIXED] - Fixed app reloading for `ReactActivity.getReactDelegate().reload()`. Pull Request resolved: facebook#44223 Test Plan: tried to temporary change toast.show as reload and test from rn-tester ```diff --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.kt @@ -10,6 +10,7 @@ package com.facebook.react.modules.toast import android.view.Gravity import android.widget.Toast import com.facebook.fbreact.specs.NativeToastAndroidSpec +import com.facebook.react.ReactActivity import com.facebook.react.bridge.NativeModule import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.UiThreadUtil @@ -30,9 +31,11 @@ public class ToastModule(reactContext: ReactApplicationContext) : ) override public fun show(message: String?, durationDouble: Double) { - val duration = durationDouble.toInt() - UiThreadUtil.runOnUiThread( - Runnable { Toast.makeText(getReactApplicationContext(), message, duration).show() }) +// val duration = durationDouble.toInt() +// UiThreadUtil.runOnUiThread( +// Runnable { Toast.makeText(getReactApplicationContext(), message, duration).show() }) + val activity = reactApplicationContext.currentActivity as? ReactActivity + activity?.reactDelegate?.reload() } override public fun showWithGravity( ``` tried for different mode - [x] bridge mode + debug build - [x] bridgeless mode + debug build - [x] bridge mode + release build - [x] bridgeless mode + release build Reviewed By: fkgozali Differential Revision: D56795975 Pulled By: arushikesarwani94 fbshipit-source-id: 895eab1927ba6db748ebb32c0fd5313f19cf9d1b
kosmydel
pushed a commit
to kosmydel/react-native
that referenced
this pull request
Jun 11, 2024
Summary: fixing some problem for `ReactActivity.getReactDelegate().reload()` from facebook#43521: - the `reload()` does not work for bridge mode on release build ## Changelog: [ANDROID] [FIXED] - Fixed app reloading for `ReactActivity.getReactDelegate().reload()`. Pull Request resolved: facebook#44223 Test Plan: tried to temporary change toast.show as reload and test from rn-tester ```diff --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.kt @@ -10,6 +10,7 @@ package com.facebook.react.modules.toast import android.view.Gravity import android.widget.Toast import com.facebook.fbreact.specs.NativeToastAndroidSpec +import com.facebook.react.ReactActivity import com.facebook.react.bridge.NativeModule import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.UiThreadUtil @@ -30,9 +31,11 @@ public class ToastModule(reactContext: ReactApplicationContext) : ) override public fun show(message: String?, durationDouble: Double) { - val duration = durationDouble.toInt() - UiThreadUtil.runOnUiThread( - Runnable { Toast.makeText(getReactApplicationContext(), message, duration).show() }) +// val duration = durationDouble.toInt() +// UiThreadUtil.runOnUiThread( +// Runnable { Toast.makeText(getReactApplicationContext(), message, duration).show() }) + val activity = reactApplicationContext.currentActivity as? ReactActivity + activity?.reactDelegate?.reload() } override public fun showWithGravity( ``` tried for different mode - [x] bridge mode + debug build - [x] bridgeless mode + debug build - [x] bridge mode + release build - [x] bridgeless mode + release build Reviewed By: fkgozali Differential Revision: D56795975 Pulled By: arushikesarwani94 fbshipit-source-id: 895eab1927ba6db748ebb32c0fd5313f19cf9d1b
This was referenced Jun 28, 2024
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
Merged
This PR has been merged.
p: Facebook
Partner: Facebook
Partner
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Changelog:
[Android] [Added] - Support reload() in ReactDelegate
Differential Revision: D54967602